home *** CD-ROM | disk | FTP | other *** search
- Path: news.sfu.ca!news
- From: Eric Kolotyluk <eric@enigma.vcr.esltd.com>
- Newsgroups: comp.lang.c++
- Subject: Initializing an Array of Strings
- Date: Fri, 08 Mar 1996 12:15:21 -0800
- Organization: Enterprise Solutions Limited
- Message-ID: <31409559.1FC6@enigma.vcr.esltd.com>
- NNTP-Posting-Host: enigma.vcr.esltd.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4m)
-
- Please reply to eric@enigma.vcr.esltd.com
-
- I thought it would be nice to create an exception class to return
- an array of strings with the names of the system services to be
- indexed by the errorType, for example:
-
- class MyClass
- {
- . . .
- class System // Exception Class for system calls
- {
- public:
-
- enum systemError
- {
- openError = 0,
- mmapError = 1,
- statError = 2,
- fcntlError = 3,
- truncateError = 4
- };
-
- systemError errorType;
- char* errorName[];
- int errno; // errno system variable
-
- System(systemError enumValue, int errorNumber)
- : errorType(enumValue)
- , errorName({ "open", "mmap", "stat", "truncate" })
- , errno(errorNumber)
- { }
- };
- };
-
- But the (Sun) C++ compiler complains
-
- The type "char*[]" is incomplete.
-
- for my definition of errorName, and generally chokes on my attempt
- to initialize errorName.
-
- Is there something basically wrong with what I'm trying to do?
- I just don't see what the problem is with the definition of errorName.
- Also, is there a way to initialize something with an array of strings?
- --
- ______________________________
- http://enigma.vcr.esltd.com/eric
-